<!-- /* Description for file.
 * 部门-新增
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/departments
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张海杰2011年0625
 * @lastmodified  张海杰2011年0625
 */
 -->
<?php
echo $html->css ( 'tab' );
echo $html->css ( 'jquery-validate/css/screen' );
?>
<script type="text/javascript">
//Form验证
$(document).ready(function() {
	 $.validator.setDefaults({       
		 submitHandler: function(form) {    
		  form.submit();    
		}       
	});   
			
	// validate signup form on keyup and submit
	$("#DepartmentAddForm").validate({
		rules: {
		 "data[Department][name]": {
				required: true,string: true,stringMinLength:0,stringMaxLength:50
			},
		"data[Department][manage]": {
				required: false,string: true,stringMinLength:0,stringMaxLength:50 
			},
		"data[Department][description]": {
				required: false,stringMinLength:0,stringMaxLength:255 
			},
		"data[Department][other]": {
				required: false,stringMinLength:0,stringMaxLength:255 
			}
		},
		messages: {
		},
		//设置验证触发事件 
		focusInvalid: false, 
		onkeyup: false, 
		//设置错误信息提示DOM  
		errorPlacement: function(error, element) { 
		error.appendTo( element.parent()); 
		}
	});
});
</script>
<!-- 当前位置-->
<div class="tabflex">
<?php echo $form->create('Department',array('action'=>'add'));?>
	<fieldset>
 		<legend><?php __('Add Departments');?></legend>
 		<table width="100%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
	<tr>
	<td>
	<?php
		echo $form->input('id'); 
		echo $form->hidden('creater');
		echo $form->hidden('created ');
		echo $form->hidden('modified ');
		echo $form->hidden('updater');?> </td>
	</tr>
	
	<tr>
		<td width="50"></td>
		<td width="100"><?php __('DepartmentsName');?>:<font color="red">*</font></td>
		<td >
		<?php echo $form->input('name',array('class' => 'TextBoxE1','label'=>false));?>
		</td>
		<td width="50"></td>
		<td width="100"><?php __('DepartmentsManage');?>:</td>
		<td>
		<?php echo $form->input('manage',array('class' => 'TextBoxE1','label'=>false));?>
		</td>
	</tr>
	<tr>
		<td width="50"></td>
		<td width="100"><?php __('Resources organs');//所属机构下拉?>:</td>
		<td colspan="4">
		<?php $options = array();
					foreach($organs  as $eachrecord)
					{	
						$options[$eachrecord['Organ']['id']] = $eachrecord['Organ']['name'];
					}
					echo $form->input('organ_id',array('options'=>$options,'label'=>false,'div'=>false,'empty' =>'不限'));
					
		?>
		</td>
	</tr>
	<tr>
		<td width="50"></td>
		<td width="100"><?php __('DepartmentsDescription');?>:</td>
		<td colspan="4">
		<?php echo $form->textarea('description',array('class' => 'areaStyle txtOut','label'=>false));?>
		</td>
	</tr>
	<tr>
		<td width="50"></td>
		<td width="100"><?php __('DepartmentsOthers');?>:</td>
		<td colspan="4">
		<?php echo $form->textarea('other',array('class' => 'areaStyle txtOut','label'=>false));?>
		</td>
	</tr>
	</table>
	</fieldset>
	<?php echo $form->button('返回',array('type'=>'button','class'=>'backsubmit','onclick'=>'history.back(-1)'));?>  <!-- 返回上一级-->
	<?php echo $form->button('确定',array('type'=>'submit','class'=>'addsubmit'));?> 	
	<?php echo $form->button('重置',array('type'=>'reset','class'=>'resetsubmit'));?>  <!-- __('reset', true)取消-->
<?php echo $form->end();?>
</div>